#pragma once
#include "pch.h"
#include "Scene.h"

namespace Fakel
{
    struct Scene;

    struct Entity
    {

        entt::entity m_Handle;

        Fakel::Scene *m_Scene = nullptr;

        Entity(Fakel::Scene *scene, entt::entity handle);

        template <typename T, typename... Args>
        T &AddOrReplaceComponent(Args &&...args)
        {
            T &component = m_Scene->m_Handle.emplace_or_replace<T>(m_Handle, std::forward<Args>(args)...);
            return component;
        }

        template <typename T, typename... Args>
        T &AddComponent(Args &&...args)
        {
            T &component = m_Scene->m_Handle.emplace<T>(m_Handle, std::forward<Args>(args)...);
            return component;
        }

        template<typename T>
        T& GetComponent()
        {
            return m_Scene->m_Handle.get<T>(m_Handle);
        }

        template<typename T>
        bool HasComponent()
        {
            return m_Scene->m_Handle.any_of<T>(m_Handle);
        }

        template<typename T>
        int RemoveComponent()
        {
            return m_Scene->m_Handle.remove<T>();
        }
    };
};